const path = require('path')
const webpack = require('webpack')
const resolve = dir => path.join(__dirname, dir)
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
  publicPath: process.env.VUE_APP_PUBLIC_PATH, //部署目录
  outputDir: process.env.VUE_APP_OUTPUT_DIR, //打包生成目录
  lintOnSave: false, //设置是否在开发环境下每次保存代码时都启用 eslint验证
  runtimeCompiler: true, // 是否使用包含运行时编译器的 Vue 构建版本
  productionSourceMap: false, // 生产环境的 source map
  chainWebpack: config => {
    config
      .plugin('html')
      .tap(args => {
        args[0].title = '法务智能机器人'
        return args
      });
    config.resolve.alias
      .set('@', resolve('./src'))
      .set('components', resolve('./src/components'));
    config.entry('main').add('@babel/polyfill');
  },
  configureWebpack: {
    resolve: {
      alias: {
        '@': resolve('src'),
      },
    },
    plugins: [
      new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery",
      }),
      new CopyWebpackPlugin([{
        from: './healthaheck.txt',
        to: './api/healthaheck.txt'
      }, {
        from: './WEB-INF',
        to: './WEB-INF'
      }])
    ],
  },
}